<template>
  <div>
    <h1>
      POSTS {{ id }}
    </h1>
  </div>
</template>

<script setup>
const route = useRoute();

// 当访问/posts/1时，route.params.id将为1
console.log(route.params.id);

const id = route.params.id;
</script>

<style></style>